<?php

namespace App\Http\Controllers;

use App\Lib\Response;
use App\Http\Services\AnalysisStatService;

class AnalysisStatController extends BaseController
{
    protected $analysisStatService;

    public function __construct()
    {
        $this->analysisStatService = new AnalysisStatService();
    }

    public function getRoomFlow()
    {
        do {
            if (!$this->checkRequest()) {
                break;
            }

            $this->callCommon($this->analysisStatService, 'getRoomFlow', $this->requestData);

        } while (false);

        if(is_string($this->responseData)) $this->responseData = json_decode($this->responseData, true);
        $data = empty($this->responseData['data']) ? new class{} : $this->responseData['data'];
        Response::returnResult($this->responseData['code'], $data, $this->responseData['msg']);
    }

    public function insertRoomFlow()
    {
        do {
            if (!$this->checkRequest(false)) {
                break;
            }

            $this->callCommon($this->analysisStatService, 'insertRoomFlow', $this->requestData);

        } while (false);

        if(is_string($this->responseData)) $this->responseData = json_decode($this->responseData, true);
        $data = empty($this->responseData['data']) ? new class{} : $this->responseData['data'];
        Response::returnResult($this->responseData['code'], $data, $this->responseData['msg']);
    }
}
